package com.anthonybennis.blender.client.pages.keyboard;

import com.anthonybennis.blender.client.UIConstants;
import com.anthonybennis.blender.client.pages.keyboard.TilePanel.PANEL;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * 
 * @author abennis
 */
public class ShortcutsPage 
{
	public Widget create()
	{
		DockLayoutPanel shortcutsPanel = new DockLayoutPanel(Unit.EM);
		shortcutsPanel.getElement().setId("shortcutspage");
		
		TileDescriptionPanel descriptionPanel = new TileDescriptionPanel();
		TilePanel tilePanel = new TilePanel(descriptionPanel);
		
		/*
		 * Left Navigation Panel
		 */
		NavigationPanel navigationPanel = new NavigationPanel(tilePanel);
		shortcutsPanel.addWest(navigationPanel.create(), UIConstants.NAVIGATION_PANEL_WIDTH);
		
		/*
		 * Tile Description
		 */
		
		descriptionPanel.hide();
		shortcutsPanel.addSouth(descriptionPanel.createWidget(), 6);

		/*
		 * Tiles
		 */		
		shortcutsPanel.add(tilePanel.create());
		
		this.init(tilePanel, navigationPanel);
		
		return shortcutsPanel;
	}
	
	/**
	 * Call from Tile Panel constructor.
	 * @param tilePanel
	 * @param navigationPanel
	 */
	private void init(TilePanel tilePanel, NavigationPanel navigationPanel)
	{
		final PANEL defaultPanel = PANEL.GENERAL; 
		tilePanel.show(defaultPanel);
		navigationPanel.highlightNavigationButton(defaultPanel);
	}
}
